<?php
require_once('./includes/headers.inc.php');
require_once('./top.php');

$error = FALSE;

//allow quick multiple checkins, by using explicit session reset
if(isset($_GET['reset'])) {
    unset($_SESSION['checkin']);
}
if(isset($_SESSION['checkin']['location_id'])) {
    header('Location: /pickroute.php');
    exit();
}

$locations = $locationMgr->getAll();
$location_list = array();
foreach($locations as $row) {
    $location_list[] =
        '<li><a href="/pickroute.php?location_id=' . $row['id'] . '">' .
        $row['name'] .
        '</a></li>';
}

$replaces = array(
    'location_list'     => implode("\n", $location_list),
    'error'             => $msgMgr->formatMsg($error),
);
$lang = array(
    'header_picklocation'   => $langMgr->get('header_picklocation'),
    'link_addlocation'      => $langMgr->get('link_addlocation'),
);
$templateMgr->loadContent(basename(__FILE__, '.php'), array_merge($replaces, $lang));
?>
